package cn.fl.ass.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cmm.mid.core.framework.page.Pager;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.ass.service.IAssDealRecAmtService;
import cn.fl.ass.transform.AssDealRecAmtVOTransform;
import cn.fl.ass.vo.AssDealRecAmtVO;
import cn.fl.framework.base.context.CurrentThreadContext;
import fl.ass.facade.api.IAssTrailCarApi;
import fl.ass.facade.condition.AssDealRecAmtQueryCondition;
import fl.ass.facade.dto.AssDealRecAmtDTO;
import fl.ass.facade.dto.MessageDTO;

/**
 * @Description: 处置收款表 客户端服务层接口实现
 * @Description: 业务层方法名称前缀：新增：add* 删除：remove* 修改：modify* 查询对象：select* get* 批量：batch* 查询集合：search*
 */
@Service
public class AssDealRecAmtServiceImpl implements IAssDealRecAmtService {

	/**
	 * 日志
	 */
	private static final Logger logger = LoggerFactory.getLogger(IAssDealRecAmtService.class);
	
	/**
	 * 拖车申请服务
	 */
	@Autowired
	private IAssTrailCarApi assTrailCarApi;

	@Override
	public AssDealRecAmtVO selectById(Long id) throws BaseException{
		if(StringUtils.isEmpty(id)){
			return null;
		}
		//TODO 业务逻辑
		MessageDTO<AssDealRecAmtDTO> dto =this.assTrailCarApi.selectAssDealRecAmtById(id);
		return AssDealRecAmtVOTransform.toVO(dto.getData());
	}

	@Override
	public Long add(AssDealRecAmtVO entity) throws BaseException{
		if(null == entity){
			return null;
		}
		MessageDTO<String> result = this.assTrailCarApi.saveAssDealRectAmt(AssDealRecAmtVOTransform.toDTO(entity));
		return result.getId();
	}

	@Override
	public boolean removeById(Long id) throws BaseException{
		if(StringUtils.isEmpty(id)){
			return false;
		}
		MessageDTO<String> response = this.assTrailCarApi.removeAssDealRecAmtById(id);
		return response.isSuccess();
	}
	
	/**
     * 删除
     * @param ids
     * @return
     */
    public boolean removeByIds(List<Long> ids)throws BaseException{
    	if(CollectionUtils.isEmpty(ids)){
			return false;
		};
		return false;
    }
    /**
     * 更新处置收款信息 kfc
     * @param ids
     * @return
     */
	@Override
	public boolean modify(AssDealRecAmtVO entity) throws BaseException{
		if(null == entity){
			return false;
		}
		MessageDTO<String> response = this.assTrailCarApi.modifyAssDealRectAmt(AssDealRecAmtVOTransform.toDTO(entity));
		
		return response.isSuccess();
	}

	@Override
	public Pager searchListPage(Pager page) throws BaseException{
		if(null == page)page = new Pager();
		//return this.assDealRecAmtApiService.searchListPage(page);
		//TODO 业务逻辑
		return null;
	}

	@Override
	public List<AssDealRecAmtVO> searchAssDealRectAmtList(
			AssDealRecAmtQueryCondition con) throws BaseException {
		if(null == con){
			con = new AssDealRecAmtQueryCondition();
		}
		return AssDealRecAmtVOTransform.toVOList(this.assTrailCarApi.searchAssDealRectAmtList(con).getDatas());
	}
}
